package com.hgs.iias.service.aspect;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;

@Aspect
public final class LoggingAspect {
	private static Log logger = LogFactory.getLog(LoggingAspect.class);
	
	@AfterThrowing(pointcut = "bean(*Service)", throwing = "t")
	public void doLogging(JoinPoint jp, Throwable t) throws Throwable {
		String className = jp.getTarget().getClass().getName();
		
//		if(t instanceof AbstractServiceException) {
			logger.warn(className, t);
//		} else {
//			logger.error(className, t);
//		}
	}
}
